package xin.nick.demo;

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;

/**
 * @Auther: Nick inickning@outlook.com
 * @Date: 2021/3/20 00:14
 * @Description:
 */
public class Txt2MySQL {
    public static void main(String[] args) throws IOException {

//        File inputFile = new File("E:\\Temp\\22");
        FileReader fileReader = new FileReader("E:\\Temp\\22\\33.txt");
        BufferedReader bufferedReader = new BufferedReader(fileReader);
        String s;
        ArrayList<String[]> exportList = new ArrayList<String[]>();
        while ((s = bufferedReader.readLine()) != null) {
            String[] ss = s.split("\t");
            if(ss.length > 1) {
                exportList.add(ss);
            }
        }

        ArrayList<String> list = Import2MySQL.appendSql(exportList);

        File outFile = new File("E:\\Temp\\22\\85.sql");
        if (!outFile.exists()) {
            outFile.createNewFile();
        }
        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(outFile));

        for(String s1 : list) {
            bufferedWriter.write(s1);
        }
        bufferedWriter.flush();
        bufferedWriter.close();
        System.out.println("OK;l;;");
    }
}
